<?php
require_once ("src/db/connectdatabase.php");

function getQuestion() {
	$con = new ConnectDB();
	$tbl = "loan_question_cong_tac_vien";
	$fn = array('question', 'answerq', 'dateupdate');
	$condetion = array('isuser' => '1');
	return $con -> getvalueorderby($tbl, $fn, $condetion, 'dateupdate');
}

function getIntro($id) {
	$con = new ConnectDB();
	$tbl = " loan_intro_footer";
	$fn = array('header', 'footer');
	$condetion = array('id' => $id);
	return $con -> getvalue($tbl, $fn, $condetion);
}

function int_to_date($int)
{
    $time  = date("d/m/Y", $int);
    return $time;
}

$arrquestionloan = getQuestion();

$id = "ct-cong-tac-vien";
$intro = getIntro($id);
?>
<script type="text/javascript" src="<?php echo($host) ?>js/mootools.js"></script>
<style>
h3 {
	font-size: 12px;
	text-decoration: none;
	color: #1c50b0;
	padding: 0px;
	margin: 0px 0px 0px 0px;
	text-align: left;
}

.faqContainer {
	padding: 10px;
}

.faqContainer .toggler {
	padding: 5px 0px 0px 15px;
	font-size: 11px;
	line-height: 17px;
	font-weight: bold;
	text-align: justify;
	background: transparent url(<?php echo($host) ?>images/bullet.gif) no-repeat scroll 0px 10px;
	cursor: pointer;
}

.elementInside {
	border-bottom: 1px solid #CCCCCC;
	margin: 4px 0px 8px 0px;
	padding: 4px 0px 10px 0px;
	font-size: 11px;
	font-weight: normal;
	font-variant: normal;
	color: #4c4c4c;
	text-decoration: none;
}

.element_atStart_dv {
	margin: 4px 0px 8px 0px;
	border-bottom: 1px solid #CCCCCC;
	height: 50px;
	font-size: 11px;
	font-weight: normal;
	font-variant: normal;
	color: #4c4c4c;
	text-decoration: none;
}

.toggler b:hover {
	color: #8DAE48;
}
</style>
<script type="text/javascript">
window.addEvent('domready', function(){
var accordion = new Accordion('h3.atStart', 'div.atStart', {
opacity: false,
onActive: function(toggler, element){
toggler.setStyle('color', '#8DAE48');
},

onBackground: function(toggler, element){
toggler.setStyle('color', '#666');
}
}, $('accordion'));

//This is for default selected optio		
var newTog = new Element('h3', {'class': 'toggler1'}).setHTML('');

var newEl = new Element('div', {'class': 'element1'}).setHTML('');

accordion.addSection(newTog, newEl, 0);
}); 

//
</script>

<div class="text12" style="margin: auto; width: 970px; height: 11px; margin-top: 11px; color: #0a8bd9;">
	<u><a href="<?php echo($host) ?>" class="text12" style="color: #0080d6;">Trang chủ</a></u>&gt; Chương trình cộng tác viên
</div>
<div class="intrl_txt" style="margin: auto;">
	<div style="width: 663px; margin-top: 0px; float: left; clear: right;">
    	<div style="width: 663px; margin-top: 15px; float: left; clear: right;">
        	<?php if (count($intro) > 0) {
				echo($intro[0][0]);
			}?>
        </div>
		<div style="width: 663px; margin-top: 15px; float: left; clear: right;">
			<div style="clear: both; height: 15px;"></div>
			<div id="txt">
				<div class="faqContainer">
					<div id="demo">
						<div id="accordion">
							<h3 class="toggler1"></h3>
							<div class="element1" style="padding-top: 0px; border-top-style: none; padding-bottom: 0px; border-bottom-style: none; overflow: hidden; height: 0px;"></div>
							<h3 class="toggler1"></h3>
							<div class="element1" style="padding-top: 0px; border-top-style: none; padding-bottom: 0px; border-bottom-style: none; overflow: hidden; height: 0px;"></div>
							
                            <?php
							for($i = 0; $i < count($arrquestionloan); $i++) {
							?>
                            
                            <h3 class="toggler atStart" style="color: rgb(34, 34, 34);"><b style="font-size:12px;">Câu hỏi <?php echo($i+1) ?>:&nbsp;<?php echo($arrquestionloan[$i][0]) ?></b>&nbsp; <i>(<?php echo(int_to_date($arrquestionloan[$i][2])) ?>)</i></h3>
							<div class="element atStart" style="padding-top: 0px; border-top-style: none; padding-bottom: 0px; border-bottom-style: none; overflow: hidden; height: 63px;">
								<div class="elementInside"><?php echo($arrquestionloan[$i][1]) ?></div>
							</div>
                            <?php
							}
							?>
						</div>
					</div>
				</div>
			</div>
		</div>
        <div style="width: 663px; margin-top: 15px; float: left; clear: right;">
        	<?php if (count($intro) > 0) {
				echo($intro[0][1]);
			}?>
        </div>
	</div>
    
    <div style="float: right; clear: right; background-image: url(<?php echo($host) ?>images/gray_bg.gif); width: 275px; height: auto; margin-top: 10px;">
        <?php include("formsendapplyloan.php"); ?>
    </div>
</div>